<template>
  <el-time-picker v-model="startTime" :clearable="clearable"></el-time-picker>
</template>

<script setup>
import {dateToTimeStr, timeStrToDate} from "~/config/utils.js"
import {ref, watch} from "vue";

let outProp = defineProps({timeStr: {}, clearable: {default: true}});
const emit = defineEmits(["update:timeStr"]);
const startTime = ref(null)
if (timeStrToDate(outProp.timeStr) != undefined) {
  startTime.value = timeStrToDate(outProp.timeStr)
}

watch(startTime, () => {
  emit("update:timeStr", dateToTimeStr(startTime.value))
})
watch(() => outProp.timeStr, () => {
  startTime.value = timeStrToDate(outProp.timeStr)
})


</script>

<style scoped>

</style>